package basic_practice_1012;

import java.util.Scanner;
/**
 * @author MemoryC
 * */
public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);
		
		while(scanner.hasNext()) {
			String[]aStrings=scanner.next().split("/");
			String[] bString=scanner.next().split("/");
			char operation=scanner.next().charAt(0);
			
			Fraction a=new Fraction(Integer.parseInt(aStrings[0]), Integer.parseInt(aStrings[1]));
			Fraction b=new Fraction(Integer.parseInt(bString[0]), Integer.parseInt(bString[1]));
			Fraction c=null;
			switch (operation) {
			case '+':
				c=Fraction.add(a, b);
				break;
			case '-':
				c=Fraction.cut(a, b);
				break;
			case '*':
				c=Fraction.multiply(a, b);
				break;
			case '/':
				c=Fraction.divide(a, b);
				break;
			default:
				break;
			}
			c.Simplify();
			System.out.println(c);
		}
		scanner.close();
	}
	
	static class Fraction{
		
		int mom=1;
		int son=0;
		boolean negtive=false;
		
		public Fraction(int son,int mom) {
			
			if(son<0) {
				son=-son;
				negtive=true;
			}else if(son==0) {
				mom=1;
			}
			
			this.son=son;
			this.mom=mom;
		}
		
		public String toString() {
			return negtive?("-"+son+"/"+mom):(son+"/"+mom);
		}
		
		static int getCommonDivisor(int a,int b) {
			if(a<b) {
				return getCommonDivisor(b,a);
			}
			int aa=a;
			int bb=b;
			
			while(aa%bb!=0) {
				int r=aa%bb;
				aa=bb;
				bb=r;
			}
			return bb;
		}
		void Simplify() {
			
			if(son==mom) {
				son=1;
				mom=1;
			}else {
				int common=getCommonDivisor(son, mom);
				son=son/common;
				mom=mom/common;
			}
				
//				if(son<mom) {
//				
//				if(mom%son==0) {
//					mom=mom/son;
//					son=1;
//					return;
//				}
//				
//				for(int i=son;i>1;) {
//					if(son%i==0&&mom%i==0) {
//						son=son/i;
//						mom=mom/i;
//						i=i>son?son:i--;
//					}else {
//						i--;
//					}
//				}
//			}else {
//				if(son%mom==0) {
//					son=son/mom;
//					mom=1;
//					return;
//				}
//				
//				for(int i=mom;i>1;) {
//					if(mom%i==0&&son%i==0) {
//						son=son/i;
//						mom=mom/i;
//						i=i>mom?mom:i--;
//					}else {
//						i--;
//					}
//				}
//			}
		}

		static Fraction add(Fraction a,Fraction b) {
			int am=a.mom,as=a.son,
				bm=b.mom,bs=b.son,
				cm=0,cs=1;
			if(a.negtive) {
				as=-as;
			}
			if(b.negtive) {
				bs=-bs;
			}
			cm=am*bm;
			cs=as*bm+bs*am;
			
			return new Fraction(cs,cm);
		}
		
		static Fraction cut(Fraction a,Fraction b) {
			int am=a.mom,as=a.son,
				bm=b.mom,bs=-b.son,
				cm=0,cs=1;
			if(a.negtive) {
				as=-as;
			}
			if(b.negtive) {
				bs=-bs;
			}
			cm=am*bm;
			cs=as*bm+bs*am;
			
			return new Fraction(cs,cm);
		}
		
		static Fraction multiply(Fraction a,Fraction b) {
			int am=a.mom,as=a.son,
				bm=b.mom,bs=b.son,
				cm=0,cs=1;
			if(a.negtive) {
				as=-as;
			}
			if(b.negtive) {
				bs=-bs;
			}
			cm=am*bm;
			cs=as*bs;
			
			return new Fraction(cs,cm);
		}
		
		static Fraction divide(Fraction a,Fraction b) {
			int am=a.mom,as=a.son,
				bm=b.son,bs=b.mom,
				cm=0,cs=1;
			if(a.negtive) {
				as=-as;
			}
			if(b.negtive) {
				bs=-bs;
			}
			cm=am*bm;
			cs=as*bs;
			
			return new Fraction(cs,cm);
		}
	}
}
